<?if(!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED!==true)die();?>
<?$this->SetViewTarget("smartFilter");?>
<?
//echo '<pre>';
//print_r($arResult["ITEMS"]);
//echo '</pre>';
?>

<form name="<?echo $arResult["FILTER_NAME"]."_form"?>" action="<?echo $arResult["FORM_ACTION"]?>" method="get" class="smartfilter">
    <?foreach($arResult["HIDDEN"] as $arItem):?>
    <input
        type="hidden"
        name="<?echo $arItem["CONTROL_NAME"]?>"
        id="<?echo $arItem["CONTROL_ID"]?>"
        value="<?echo $arItem["HTML_VALUE"]?>"
        />
    <?endforeach;?>
    <?foreach($arResult["ITEMS"] as $arItem):
        if($arItem["CODE"] == 'BASE'):?>
            <h4>ЦЕНА</h4>
            <div id="price-slider-wrapper">
                от <input type="text" name="arrFilter_P1_MIN" class="price-range" id="min-price-range" value="<?=$arItem["VALUES"]["MIN"]["HTML_VALUE"]?>">
                до <input type="text" name="arrFilter_P1_MAX" class="price-range" id="max-price-range" value="<?=$arItem["VALUES"]["MAX"]["HTML_VALUE"]?>"> руб
                <div id="price-slider"></div>
            </div>
        <?endif;
    endforeach;?>
    <?foreach($arResult["ITEMS"] as $arItem):
        if($arItem["CODE"] == 'MANUFACTURER'):?>
            <h4>Производители</h4>
            <ul id="popular-manufacturers">
                <li class="first"><input id="all-manufacturers" type="checkbox"><label for="all-manufacturers">Все производители</label></li>
                <?foreach($arItem["VALUES"] as $val => $ar):?>
                    <li><input name="<?echo $ar["CONTROL_NAME"]?>" <?echo $ar["CHECKED"]? 'checked="checked"': ''?> id="<?=$ar["CONTROL_ID"]?>" type="checkbox" value="<?echo $ar["HTML_VALUE"]?>"><label for="<?=$ar["CONTROL_ID"]?>"><?=$ar["VALUE"]?></label></li>
                <?endforeach;?>
            </ul>
        <?endif;?>
    <?endforeach;?>
    <h4>Тип <!-- <span class="hint"></span> --></h4>
    <ul id="type-filters">
        <?foreach($arResult["ITEMS"] as $arItem):
            if($arItem["CODE"] != 'BASE' && $arItem["CODE"] != 'MANUFACTURER' ):?>
                <li>
                    <a href="javascript:void(0);"><?=$arItem["NAME"]?></a>
                   <!-- <span class="hint"></span> -->
                    <ul class="checkboxes">
                        <?foreach($arItem["VALUES"] as $val => $ar):?>
                            <li class="checkbox">
                                <input name="<?echo $ar["CONTROL_NAME"]?>" id="<?echo $ar["CONTROL_ID"]?>" <?echo $ar["CHECKED"]? 'checked="checked"': ''?> type="checkbox" value="<?echo $ar["HTML_VALUE"]?>" />
                                <label><?=$ar["VALUE"]?></label>
                                <!-- <span class="hint"></span> -->
                            </li>
                        <?endforeach;?>
                    </ul>
                </li>
            <?endif;?>
        <?endforeach?>
    </ul>
    <input type="submit" id="filter-submit" name="set_filter" value="<?=GetMessage("CT_BCSF_SET_FILTER")?>" />
    <!--<a href="" class="show-all-params">Все параметры</a>-->
    <input type="submit" class="show-all-params" id="del_filter" name="del_filter" value="Сбросить параметры" />

    <div class="modef" id="modef" <?if(!isset($arResult["ELEMENT_COUNT"])) echo 'style="display:none"';?>>
        <?echo GetMessage("CT_BCSF_FILTER_COUNT", array("#ELEMENT_COUNT#" => '<span id="modef_num">'.intval($arResult["ELEMENT_COUNT"]).'</span>'));?>
        <a href="<?echo $arResult["FILTER_URL"]?>" class="showchild"><?echo GetMessage("CT_BCSF_FILTER_SHOW")?></a>
    </div>
</form>
<?$this->EndViewTarget();?>

<?/*?>
<form name="<?echo $arResult["FILTER_NAME"]."_form"?>" action="<?echo $arResult["FORM_ACTION"]?>" method="get" class="smartfilter">
	<?foreach($arResult["HIDDEN"] as $arItem):?>
		<input
			type="hidden"
			name="<?echo $arItem["CONTROL_NAME"]?>"
			id="<?echo $arItem["CONTROL_ID"]?>"
			value="<?echo $arItem["HTML_VALUE"]?>"
		/>
	<?endforeach;?>
	<div class="filtren">
		<h5><?echo GetMessage("CT_BCSF_FILTER_TITLE")?></h5>
		<ul>
		<?foreach($arResult["ITEMS"] as $arItem):
           // print_r($arItem);?>
			<?if($arItem["PROPERTY_TYPE"] == "N" || isset($arItem["PRICE"])):?>
			<li class="lvl1"> <a href="#" onclick="BX.toggle(BX('ul_<?echo $arItem["ID"]?>')); return false;" class="showchild"><?=$arItem["NAME"]?></a>
				<ul id="ul_<?echo $arItem["ID"]?>">
					<?
						//$arItem["VALUES"]["MIN"]["VALUE"];
						//$arItem["VALUES"]["MAX"]["VALUE"];
					?>
					<li class="lvl2">
						<table border="0" cellpadding="0" cellspacing="0">
							<tr>
								<td>
									<span class="max-price"><?echo GetMessage("CT_BCSF_FILTER_TO")?></span>
								</td>
								<td>
									<span class="min-price"><?echo GetMessage("CT_BCSF_FILTER_FROM")?></span>
								</td>
							</tr>
							<tr>
								<td><input
									class="max-price"
									type="text"
									name="<?echo $arItem["VALUES"]["MAX"]["CONTROL_NAME"]?>"
									id="<?echo $arItem["VALUES"]["MAX"]["CONTROL_ID"]?>"
									value="<?//echo $arItem["VALUES"]["MAX"]["HTML_VALUE"]?>"
									size="5"
									onkeyup="smartFilter.keyup(this)"
								/></td>
								<td><input
									class="min-price"
									type="text"
									name="<?echo $arItem["VALUES"]["MIN"]["CONTROL_NAME"]?>"
									id="<?echo $arItem["VALUES"]["MIN"]["CONTROL_ID"]?>"
									value="<?echo $arItem["VALUES"]["MIN"]["HTML_VALUE"]?>"
									size="5"
									onkeyup="smartFilter.keyup(this)"
								/></td>
							</tr>
						</table>
					</li>
				</ul>
			</li>
			<?elseif(!empty($arItem["VALUES"])):;?>
			<li class="lvl1"> <a href="#" onclick="BX.toggle(BX('ul_<?echo $arItem["ID"]?>')); return false;" class="showchild"><?=$arItem["NAME"]?></a>
				<ul id="ul_<?echo $arItem["ID"]?>">
					<?foreach($arItem["VALUES"] as $val => $ar):?>
					<li class="lvl2<?echo $ar["DISABLED"]? ' lvl2_disabled': ''?>"><input
						type="checkbox"
						value="<?echo $ar["HTML_VALUE"]?>"
						name="<?echo $ar["CONTROL_NAME"]?>"
						id="<?echo $ar["CONTROL_ID"]?>"
						<?echo $ar["CHECKED"]? 'checked="checked"': ''?>
						onclick="smartFilter.click(this)"
					/><label for="<?echo $ar["CONTROL_ID"]?>"><?echo $ar["VALUE"];?></label></li>
					<?endforeach;?>
				</ul>
			</li>
			<?endif;?>
		<?endforeach;?>
		</ul>
		<input type="submit" id="set_filter" name="set_filter" value="<?=GetMessage("CT_BCSF_SET_FILTER")?>" />
		<input type="submit" id="del_filter" name="del_filter" value="<?=GetMessage("CT_BCSF_DEL_FILTER")?>" />

		<div class="modef" id="modef" <?if(!isset($arResult["ELEMENT_COUNT"])) echo 'style="display:none"';?>>
			<?echo GetMessage("CT_BCSF_FILTER_COUNT", array("#ELEMENT_COUNT#" => '<span id="modef_num">'.intval($arResult["ELEMENT_COUNT"]).'</span>'));?>
			<a href="<?echo $arResult["FILTER_URL"]?>" class="showchild"><?echo GetMessage("CT_BCSF_FILTER_SHOW")?></a>
			<!--<span class="ecke"></span>-->
		</div>
	</div>
</form>
<script>
	var smartFilter = new JCSmartFilter('<?echo CUtil::JSEscape($APPLICATION->GetCurPageParam())?>');
</script>